/*
 * 一些经验
 * 1、forEach时灵时不灵
 * 2、for in注意排除非数据
 * 3、注意变量作用域，使用前先定义
 */
var rule = {
    title:'央视',
    host:'https://api.cntv.cn',
    url:'fyclass/fyfilter/fypage',
    filter_url:'{{fl.cid}}/{{fl.fc}}/{{fl.fl}}/{{fl.year}}/{{fl.month}}/{{fl.sc}}/{{fl.area}}/{{fl.letter}}/{{fl.channel}}',
    filter:{'lanmu':[{'key':'cid','name':'频道','value':[{'n':'全部','v':''},{'n':'CCTV-1综合','v':'EPGC1386744804340101'},{'n':'CCTV-2财经','v':'EPGC1386744804340102'},{'n':'CCTV-3综艺','v':'EPGC1386744804340103'},{'n':'CCTV-4中文国际','v':'EPGC1386744804340104'},{'n':'CCTV-5体育','v':'EPGC1386744804340107'},{'n':'CCTV-6电影','v':'EPGC1386744804340108'},{'n':'CCTV-7国防军事','v':'EPGC1386744804340109'},{'n':'CCTV-8电视剧','v':'EPGC1386744804340110'},{'n':'CCTV-9纪录','v':'EPGC1386744804340112'},{'n':'CCTV-10科教','v':'EPGC1386744804340113'},{'n':'CCTV-11戏曲','v':'EPGC1386744804340114'},{'n':'CCTV-12社会与法','v':'EPGC1386744804340115'},{'n':'CCTV-13新闻','v':'EPGC1386744804340116'},{'n':'CCTV-14少儿','v':'EPGC1386744804340117'},{'n':'CCTV-15音乐','v':'EPGC1386744804340118'},{'n':'CCTV-16奥林匹克','v':'EPGC1634630207058998'},{'n':'CCTV-17农业农村','v':'EPGC1563932742616872'},{'n':'CCTV-5+体育赛事','v':'EPGC1468294755566101'}]},{'key':'fc','name':'分类','value':[{'n':'全部','v':''},{'n':'新闻','v':'新闻'},{'n':'体育','v':'体育'},{'n':'综艺','v':'综艺'},{'n':'健康','v':'健康'},{'n':'生活','v':'生活'},{'n':'科教','v':'科教'},{'n':'经济','v':'经济'},{'n':'农业','v':'农业'},{'n':'法治','v':'法治'},{'n':'军事','v':'军事'},{'n':'少儿','v':'少儿'},{'n':'动画','v':'动画'},{'n':'纪实','v':'纪实'},{'n':'戏曲','v':'戏曲'},{'n':'音乐','v':'音乐'},{'n':'影视','v':'影视'}]},{'key':'fl','name':'首字母','value':[{'n':'全部','v':''},{'n':'A','v':'A'},{'n':'B','v':'B'},{'n':'C','v':'C'},{'n':'D','v':'D'},{'n':'E','v':'E'},{'n':'F','v':'F'},{'n':'G','v':'G'},{'n':'H','v':'H'},{'n':'I','v':'I'},{'n':'J','v':'J'},{'n':'K','v':'K'},{'n':'L','v':'L'},{'n':'M','v':'M'},{'n':'N','v':'N'},{'n':'O','v':'O'},{'n':'P','v':'P'},{'n':'Q','v':'Q'},{'n':'R','v':'R'},{'n':'S','v':'S'},{'n':'T','v':'T'},{'n':'U','v':'U'},{'n':'V','v':'V'},{'n':'W','v':'W'},{'n':'X','v':'X'},{'n':'Y','v':'Y'},{'n':'Z','v':'Z'}]},{'key':'year','name':'年份','value':[{'n':'全部','v':''},{'n':'2024','v':'2024'},{'n':'2023','v':'2023'},{'n':'2022','v':'2022'},{'n':'2021','v':'2021'},{'n':'2020','v':'2020'},{'n':'2019','v':'2019'},{'n':'2018','v':'2018'},{'n':'2017','v':'2017'},{'n':'2016','v':'2016'},{'n':'2015','v':'2015'},{'n':'2014','v':'2014'},{'n':'2013','v':'2013'},{'n':'2012','v':'2012'},{'n':'2011','v':'2011'},{'n':'2010','v':'2010'},{'n':'2009','v':'2009'},{'n':'2008','v':'2008'}]},{'key':'month','name':'月份','value':[{'n':'全部','v':''},{'n':'01','v':'01'},{'n':'02','v':'02'},{'n':'03','v':'03'},{'n':'04','v':'04'},{'n':'05','v':'05'},{'n':'06','v':'06'},{'n':'07','v':'07'},{'n':'08','v':'08'},{'n':'09','v':'09'},{'n':'10','v':'10'},{'n':'11','v':'11'},{'n':'12','v':'12'}]}],'dsj':[{'key':'sc','name':'类型','value':[{'n':'全部','v':''},{'n':'谍战','v':'谍战'},{'n':'悬疑','v':'悬疑'},{'n':'刑侦','v':'刑侦'},{'n':'历史','v':'历史'},{'n':'古装','v':'古装'},{'n':'武侠','v':'武侠'},{'n':'军旅','v':'军旅'},{'n':'战争','v':'战争'},{'n':'喜剧','v':'喜剧'},{'n':'青春','v':'青春'},{'n':'言情','v':'言情'},{'n':'偶像','v':'偶像'},{'n':'家庭','v':'家庭'},{'n':'年代','v':'年代'},{'n':'革命','v':'革命'},{'n':'农村','v':'农村'},{'n':'都市','v':'都市'},{'n':'其他','v':'其他'}]},{'key':'area','name':'地区','value':[{'n':'全部','v':''},{'n':'内地（大陆）','v':'内地（大陆）'},{'n':'港澳台','v':'港澳台'},{'n':'欧美','v':'欧美'},{'n':'日韩','v':'日韩'},{'n':'其他','v':'其他'}]},{'key':'year','name':'年份','value':[{'n':'全部','v':''},{'n':'2024','v':'2024'},{'n':'2023','v':'2023'},{'n':'2022','v':'2022'},{'n':'2021','v':'2021'},{'n':'2020','v':'2020'},{'n':'2019','v':'2019'},{'n':'2018','v':'2018'},{'n':'2017','v':'2017'},{'n':'2016','v':'2016'},{'n':'2015','v':'2015'},{'n':'2014','v':'2014'},{'n':'2013','v':'2013'},{'n':'2012','v':'2012'},{'n':'2011','v':'2011'},{'n':'2010','v':'2010'},{'n':'2009','v':'2009'},{'n':'2008','v':'2008'},{'n':'2007','v':'2007'},{'n':'2006','v':'2006'},{'n':'2005','v':'2005'},{'n':'2004','v':'2004'},{'n':'2003','v':'2003'},{'n':'2002','v':'2002'},{'n':'2001','v':'2001'},{'n':'2000','v':'2000'},{'n':'1999','v':'1999'},{'n':'1998','v':'1998'}]},{'key':'letter','name':'首字母','value':[{'n':'全部','v':''},{'n':'A','v':'A'},{'n':'B','v':'B'},{'n':'C','v':'C'},{'n':'D','v':'D'},{'n':'E','v':'E'},{'n':'F','v':'F'},{'n':'G','v':'G'},{'n':'H','v':'H'},{'n':'I','v':'I'},{'n':'J','v':'J'},{'n':'K','v':'K'},{'n':'L','v':'L'},{'n':'M','v':'M'},{'n':'N','v':'N'},{'n':'O','v':'O'},{'n':'P','v':'P'},{'n':'Q','v':'Q'},{'n':'R','v':'R'},{'n':'S','v':'S'},{'n':'T','v':'T'},{'n':'U','v':'U'},{'n':'V','v':'V'},{'n':'W','v':'W'},{'n':'X','v':'X'},{'n':'Y','v':'Y'},{'n':'Z','v':'Z'}]}],'dhp':[{'key':'sc','name':'类型','value':[{'n':'全部','v':''},{'n':'亲子','v':'亲子'},{'n':'搞笑','v':'搞笑'},{'n':'冒险','v':'冒险'},{'n':'动作','v':'动作'},{'n':'宠物','v':'宠物'},{'n':'体育','v':'体育'},{'n':'益智','v':'益智'},{'n':'历史','v':'历史'},{'n':'教育','v':'教育'},{'n':'校园','v':'校园'},{'n':'言情','v':'言情'},{'n':'武侠','v':'武侠'},{'n':'经典','v':'经典'},{'n':'未来','v':'未来'},{'n':'古代','v':'古代'},{'n':'神话','v':'神话'},{'n':'真人','v':'真人'},{'n':'励志','v':'励志'},{'n':'热血','v':'热血'},{'n':'奇幻','v':'奇幻'},{'n':'童话','v':'童话'},{'n':'剧情','v':'剧情'},{'n':'夺宝','v':'夺宝'},{'n':'其他','v':'其他'}]},{'key':'area','name':'地区','value':[{'n':'全部','v':''},{'n':'内地（大陆）','v':'内地（大陆）'},{'n':'港澳台','v':'港澳台'},{'n':'欧美','v':'欧美'}]},{'key':'letter','name':'首字母','value':[{'n':'全部','v':''},{'n':'A','v':'A'},{'n':'B','v':'B'},{'n':'C','v':'C'},{'n':'D','v':'D'},{'n':'E','v':'E'},{'n':'F','v':'F'},{'n':'G','v':'G'},{'n':'H','v':'H'},{'n':'I','v':'I'},{'n':'J','v':'J'},{'n':'K','v':'K'},{'n':'L','v':'L'},{'n':'M','v':'M'},{'n':'N','v':'N'},{'n':'O','v':'O'},{'n':'P','v':'P'},{'n':'Q','v':'Q'},{'n':'R','v':'R'},{'n':'S','v':'S'},{'n':'T','v':'T'},{'n':'U','v':'U'},{'n':'V','v':'V'},{'n':'W','v':'W'},{'n':'X','v':'X'},{'n':'Y','v':'Y'},{'n':'Z','v':'Z'}]}],'jlp':[{'key':'channel','name':'频道','value':[{'n':'全部','v':''},{'n':'CCTV-1 综合','v':'CCTV-1综合,CCTV-1高清,CCTV-1综合高清'},{'n':'CCTV-2 财经','v':'CCTV-2财经,CCTV-2高清,CCTV-2财经高清'},{'n':'CCTV-3 综艺','v':'CCTV-3综艺,CCTV-3综艺高清'},{'n':'CCTV-4 中文国际','v':'CCTV-4中文国际,CCTV-4高清,CCTV-4中文国际(亚)高清'},{'n':'CCTV-5 体育','v':'CCTV-5体育,CCTV-5体育高清'},{'n':'CCTV-6 电影','v':'CCTV-6电影,CCTV-6电影高清'},{'n':'CCTV-7 国防军事','v':'CCTV-7军事农业,CCTV-7军事农业高清,CCTV-7国防军事高清'},{'n':'CCTV-9 纪录','v':'CCTV-9纪录,CCTV-9高清,CCTV-9纪录高清'},{'n':'CCTV-10 科教','v':'CCTV-10科教,CCTV-10高清,CCTV-10科教高清'},{'n':'CCTV-11 戏曲','v':'CCTV-11戏曲'},{'n':'CCTV-12 社会与法','v':'CCTV-12社会与法,CCTV-12社会与法高清'},{'n':'CCTV-13 新闻','v':'CCTV-13新闻'},{'n':'CCTV-14 少儿','v':'CCTV-14少儿,CCTV-14少儿高清'},{'n':'CCTV-15 音乐','v':'CCTV-15音乐,CCTV-15音乐高清'},{'n':'CCTV-17 农业农村','v':'CCTV-17农业农村高清'}]},{'key':'sc','name':'类型','value':[{'n':'全部','v':''},{'n':'人文历史','v':'人文历史'},{'n':'人物','v':'人物'},{'n':'军事','v':'军事'},{'n':'探索','v':'探索'},{'n':'社会','v':'社会'},{'n':'自然','v':'自然'},{'n':'时政','v':'时政'},{'n':'经济','v':'经济'},{'n':'科技','v':'科技'}]},{'key':'year','name':'年份','value':[{'n':'全部','v':''},{'n':'2024','v':'2024'},{'n':'2023','v':'2023'},{'n':'2022','v':'2022'},{'n':'2021','v':'2021'},{'n':'2020','v':'2020'},{'n':'2019','v':'2019'},{'n':'2018','v':'2018'},{'n':'2017','v':'2017'},{'n':'2016','v':'2016'},{'n':'2015','v':'2015'},{'n':'2014','v':'2014'},{'n':'2013','v':'2013'},{'n':'2012','v':'2012'},{'n':'2011','v':'2011'},{'n':'2010','v':'2010'},{'n':'2009','v':'2009'}]},{'key':'letter','name':'首字母','value':[{'n':'全部','v':''},{'n':'A','v':'A'},{'n':'B','v':'B'},{'n':'C','v':'C'},{'n':'D','v':'D'},{'n':'E','v':'E'},{'n':'F','v':'F'},{'n':'G','v':'G'},{'n':'H','v':'H'},{'n':'I','v':'I'},{'n':'J','v':'J'},{'n':'K','v':'K'},{'n':'L','v':'L'},{'n':'M','v':'M'},{'n':'N','v':'N'},{'n':'O','v':'O'},{'n':'P','v':'P'},{'n':'Q','v':'Q'},{'n':'R','v':'R'},{'n':'S','v':'S'},{'n':'T','v':'T'},{'n':'U','v':'U'},{'n':'V','v':'V'},{'n':'W','v':'W'},{'n':'X','v':'X'},{'n':'Y','v':'Y'},{'n':'Z','v':'Z'}]}],'tbjm':[{'key':'channel','name':'频道','value':[{'n':'全部','v':''},{'n':'CCTV-1 综合','v':'CCTV-1综合,CCTV-1高清,CCTV-1综合高清'},{'n':'CCTV-2 财经','v':'CCTV-2财经,CCTV-2高清,CCTV-2财经高清'},{'n':'CCTV-3 综艺','v':'CCTV-3综艺,CCTV-3高清,CCTV-3综艺高清'},{'n':'CCTV-4 中文国际','v':'CCTV-4中文国际,CCTV-4高清,CCTV-4中文国际(亚)高清'},{'n':'CCTV-5 体育','v':'CCTV-5体育,CCTV-5高清,CCTV-5体育高清'},{'n':'CCTV-6 电影','v':'CCTV-6电影,CCTV-6高清,CCTV-6电影高清'},{'n':'CCTV-7 国防军事','v':'CCTV-7军事农业,CCTV-7高清,CCTV-7军事农业高清,CCTV-7国防军事高清'},{'n':'CCTV-8 电视剧','v':'CCTV-8电视剧,CCTV-8高清,CCTV-8电视剧高清'},{'n':'CCTV-9 纪录','v':'CCTV-9纪录,CCTV-9高清,CCTV-9纪录高清'},{'n':'CCTV-10 科教','v':'CCTV-10科教,CCTV-10高清,CCTV-10科教高清'},{'n':'CCTV-11 戏曲','v':'CCTV-11戏曲,CCTV-11高清,CCTV-11戏曲高清'},{'n':'CCTV-12 社会与法','v':'CCTV-12社会与法,CCTV-12高清,CCTV-12社会与法高清'},{'n':'CCTV-13 新闻','v':'CCTV-13新闻,CCTV-13高清,CCTV-13新闻高清'},{'n':'CCTV-14 少儿','v':'CCTV-14少儿,CCTV-14高清,CCTV-14少儿高清'},{'n':'CCTV-15 音乐','v':'CCTV-15音乐,CCTV-15高清,CCTV-15音乐高清'},{'n':'CCTV-17 农业农村','v':'CCTV-17农业农村高清'}]},{'key':'sc','name':'类型','value':[{'n':'全部','v':''},{'n':'新闻','v':'新闻'},{'n':'经济','v':'经济'},{'n':'综艺','v':'综艺'},{'n':'体育','v':'体育'},{'n':'军事','v':'军事'},{'n':'影视','v':'影视'},{'n':'科教','v':'科教'},{'n':'戏曲','v':'戏曲'},{'n':'青少','v':'青少'},{'n':'音乐','v':'音乐'},{'n':'社会','v':'社会'},{'n':'文化','v':'文化'},{'n':'公益','v':'公益'},{'n':'其他','v':'其他'}]},{'key':'letter','name':'首字母','value':[{'n':'全部','v':''},{'n':'A','v':'A'},{'n':'B','v':'B'},{'n':'C','v':'C'},{'n':'D','v':'D'},{'n':'E','v':'E'},{'n':'F','v':'F'},{'n':'G','v':'G'},{'n':'H','v':'H'},{'n':'I','v':'I'},{'n':'J','v':'J'},{'n':'K','v':'K'},{'n':'L','v':'L'},{'n':'M','v':'M'},{'n':'N','v':'N'},{'n':'O','v':'O'},{'n':'P','v':'P'},{'n':'Q','v':'Q'},{'n':'R','v':'R'},{'n':'S','v':'S'},{'n':'T','v':'T'},{'n':'U','v':'U'},{'n':'V','v':'V'},{'n':'W','v':'W'},{'n':'X','v':'X'},{'n':'Y','v':'Y'},{'n':'Z','v':'Z'}]}]},
    detailUrl:'',
    searchUrl: 'https://search.cctv.com/search.php?qtext=**&type=video',
    searchable: 2,
    quickSearch: 0,
    filterable:1,//是否启用分类筛选,
    headers:{
        'Accept-Encoding': 'no-zip',
        'User-Agent': 'PC_UA',
        'Origin': 'https://tv.cctv.com',
        'Referer': 'https://tv.cctv.com/'
    },
    timeout:5000,
    class_name:'栏目大全&电视剧&动画片&纪录片&特别节目',
    class_url:'lanmu&dsj&dhp&jlp&tbjm',
    pagecount:{'lanmu':50,'dsj':50,'dhp':50,'jlp':50,'tbjm':50},
    play_parse:true,
    lazy:`js:
        log('播放接口 input: ' + input);
        function getPlayUrl(input) {
            let guid = input.split(',,')[0];
            let jo = JSON.parse(request('https://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid='+guid));
            let link = jo['hls_url'];
            let url_prefix = link.match(/(http[s]?:\\\/\\\/[a-zA-z0-9.]+)/)[1];
            let content = request(link);
            let regex = /\\s+([^#\\s]+)\\s+/g;
            let line = regex.exec(content);
            let url = '';
            while(line) {
                url = line[1];
                line = regex.exec(content)
            }
            let subUrl = url.split('/');
            url = url_prefix + url;
            subUrl[3] = '2000';
            subUrl[subUrl.length-1] = '2000.m3u8';
            let hd_url = url_prefix + subUrl.join('/');
            let hd_rsp = request(hd_url);
            if(0 == hd_rsp.indexOf('#EXT')) {
                url = hd_url
            }
            return url
        }

        input = {
            'parse': 0,
            'playUrl': '',
            'url': getPlayUrl(input)
        }
    `,
    limit:6,
    // 列表;标题;图片;描述;链接;详情 其中最后一个参数选填
    推荐:'',
    一级:`js:
        log('一级 input: ' + input);
        let d = [];
        let param_keys = ['cid','fc','fl','year','month','sc','area','letter','channel','p'],
            pianku_configs = {
                'dsj': {'channelid': 'CHAL1460955853485115', 'fc': '电视剧'},
                'dhp': {'channelid': 'CHAL1460955899450127', 'fc': '动画片'},
                'jlp': {'channelid': 'CHAL1460955924871139', 'fc': '纪录片'},
                'tbjm': {'channelid': 'CHAL1460955953877151', 'fc': '特别节目'}
            },
            limit = 30;

        let inputSplit = input.split('/'), originUrl = inputSplit.slice(0,3).join('/'), tid = inputSplit[3], params = inputSplit.slice(4, inputSplit.length);

        let url_params = '', year = '', month = '';
        param_keys.forEach(function(item, idx) {
            if(params[idx].length > 0) {
                url_params += '&' + item + '=' + params[idx];
                if('year' == item) year = params[idx];
                if('month' == item) month = params[idx];
            }
        });

        if('lanmu' == tid) {
            let jsondata = JSON.parse(request('https://api.cntv.cn/lanmu/columnSearch?n='+limit+url_params+'&serviceId=tvcctv&t=json'));
            let vods = jsondata['response']['docs'];
            vods.forEach(function(vod) {
                let lastVideo = vod['lastVIDE']['videoSharedCode'];
                if(null == lastVideo || lastVideo.length < 1) lastVideo = '_';
                d.push({
                    url:'https://api.cntv.cn/'+year+month+'---'+vod['column_name']+'---'+lastVideo+'---'+vod['column_logo'],
                    title:vod['column_name'],
                    img:vod['column_logo'],
                    desc:''
                })
            })
        } else {
            let jsondata = JSON.parse(request('https://api.cntv.cn/list/getVideoAlbumList?channelid='+pianku_configs[tid]['channelid']+'&fc='+pianku_configs[tid]['fc']+'&n='+limit+url_params+'&serviceId=tvcctv&topv=1&t=json'));
            let vods = jsondata['data']['list'];
            vods.forEach(function(vod) {
                d.push({
                    url:'https://api.cntv.cn/'+tid+'---'+vod['title']+'---'+vod['video']['id']+'---',
                    title:vod['title'],
                    img:vod['image'],
                    desc:vod['sc']
                })
            })
        }

        setResult(d)
    `,
    二级:`js:
        log('二级 input: ' + input);
        function getVodXiaoK(input) {
            let vod = {
                vod_id: input,
                vod_name: '',
                vod_pic: '',
                type_name: '',
                vod_year: '',
                vod_area: '',
                vod_remarks: '',
                vod_actor: '',
                vod_director: '',
                vod_content: '',
                vod_play_from: '',
                vod_play_url: ''
            };

            let inputSplit = input.split('/'), originUrl = inputSplit.slice(0,3).join('/'), param_str = input.substr(originUrl.length+1), params = param_str.split('---');
            let pianku_configs = {'dsj':1, 'dhp':1, 'jlp':1, 'tbjm':1, 'pianku':1};
            let tid = params[0], title = params[1], video_id = params[2], logo = params[3];
            let topicId = '', channel = '', date = '', new_video_id = '';

            if('search' == tid) {
                let content = request(video_id);
                if(video_id.indexOf('cctv.com/lm/') > 0) {
                    topicId = content.match(/var\\s+topicID\\s*=\\s*'(.*?)'/)[1];
                    channel = jsp.pdfh(content, 'meta[name="keywords"]&&content');
                    tid = 'lanmu'
                } else {
                    let video_url = jsp.pdfh(content, "#fpy_ind04 dd .text a:eq(0)&&href");
                    if(video_url.length > 0) {
                        video_id = video_url.substring(video_url.lastIndexOf('/')+1, video_url.lastIndexOf('.shtml'))
                    } else {
                        video_id = video_id.substring(video_id.lastIndexOf('/')+1, video_id.lastIndexOf('.shtml'))
                        vod['vod_name'] = jsp.pdfh(content, 'meta[property="og:title"]&&content');
                        let vod_pic = jsp.pdfh(content, '.fpy_ind01 .left .image img:eq(0)&&src');
                        if(0 == vod_pic.indexOf('//')) vod_pic = 'https' + vod_pic;
                        vod['vod_pic'] = vod_pic;
                        let type_name = content.match(/var\\s+zipin_name\\s*=\\s*"(.*?)"/);
                        vod['type_name'] = type_name ? type_name[1] : '';
                        vod['vod_content'] = jsp.pdfh(content, 'meta[property="og:description"]&&content');
                        let vod_play_from = content.match(/var\\s+testapp\\s*=\\s*"CCTV节目官网-(.*?)"/);
                        vod['vod_play_from'] = vod_play_from ? vod_play_from[1] : '';
                        new_video_id = video_id;
                    }
                    tid = 'pianku'
                }
            }

            if('undefined' != typeof pianku_configs[tid]) {
                if(new_video_id.length < 1) {
                    let info = JSON.parse(request('https://api.cntv.cn/NewVideoset/getVideoAlbumInfoByVideoId?id='+video_id+'&serviceId=tvcctv&t=json'));
                    if('undefined' == typeof info['data']) {
                        return vod
                    } else {
                        vod['vod_name'] = info['data']['title'];
                        vod['vod_pic'] = info['data']['image'];
                        vod['type_name'] = info['data']['title'];
                        vod['vod_content'] = info['data']['brief'];
                        vod['vod_play_from'] = info['data']['fc'];
                    }
                    new_video_id = info['data']['id'];
                }

                let limit = 100;
                let page = 1;
                let url_format = 'https://api.cntv.cn/NewVideo/getVideoListByAlbumIdNew?id='+new_video_id+'&serviceId=tvcctv&pub=1&mode=0&p={}&n='+limit+'&sort=asc&t=json';
                if('dhp' == tid) {
                    url_format = 'https://api.cntv.cn/NewVideo/getVideoStreamByAlbumId?id='+new_video_id+'&mode=1&sort=asc&n='+limit+'&serviceId=tvcctv&order=0&p={}&type=json'
                }
                let url = url_format.replace('{}', page);
                let jo = JSON.parse(request(url));
                if('undefined' == typeof jo['data'] || 'undefined' == typeof jo['data']['list']) {
                    return vod
                }
                let last_part = limit;
                if('undefined' != typeof jo['data']['total']) {
                    last_part = jo['data']['total']
                }
                let loop_count = 0, vodList = [], videoList = [];
                while(last_part > (page-1)*limit) {
                    vodList = jo['data']['list'];
                    vodList.forEach(function(video) {
                        videoList.push(video['title']+'$'+video['guid']+',,'+video['vip_flag'])
                    });
                    page += 1
                    loop_count += 1
                    // 防bug死循环，超过300集的剧也就看前300吧
                    if((page-1)*limit >= last_part || loop_count > 2) {
                        break
                    }
                    url = url_format.replace('{}', page);
                    jo = JSON.parse(request(url))
                }
                vod['vod_play_url'] = videoList.join('#')
            } else if('search' != tid) {
                if('lanmu' != tid) {
                    date = tid;
                    if(video_id == '_') {
                        return vod
                    }
                    let lastUrl = 'https://api.cntv.cn/video/videoinfoByGuid?guid='+video_id+'&serviceId=tvcctv';
                    let lastJo = JSON.parse(request(lastUrl));
                    topicId = lastJo['ctid'];
                    channel = lastJo['channel'];
                    if(date.length > 0) {
                        title = date + ' ' + title
                    }
                }

                let url = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?id='+topicId+'&d='+date+'&p=1&n=100&sort=desc&mode=0&serviceId=tvcctv&t=json';
                let jo = JSON.parse(request(url)), vodList = jo['data']['list'], videoList = [];
                vodList.forEach(function(video) {
                    videoList.push(video['title']+'$'+video['guid'])
                });
                if(videoList.length == 0) {
                    return vod
                }
                if(date.length == 0) {
                    date = new Date().getFullYear()
                }
                vod['vod_name'] = title;
                vod['vod_pic'] = logo;
                vod['type_name'] = channel;
                vod['vod_year'] = date;
                vod['vod_remarks'] = date;
                vod['vod_director'] = topicId;
                vod['vod_content'] = '当前页面默认只展示最新100期的内容，可在分类页面选择年份和月份进行往期节目查看。年份和月份仅影响当前页面内容，不参与分类过滤。视频默认播放可以获取到的最高帧率。';
                vod['vod_play_from'] = '栏目大全';
                vod['vod_play_url'] = videoList.join('#');
            }

            return vod
        }
        VOD = getVodXiaoK(input)
    `,
    搜索:`js:
        log('搜索 input: ' + input);
        let videos = [];
        let content = request(input), results = jsp.pdfa(content, '.search17354_ind01 .ind01');
        results.forEach(function(item) {
            let url = jsp.pdfh(item, "h3&&a:eq(0)&&href"),
                title = jsp.pdfh(item, "h3&&a:eq(0)&&Text").replace(/\\n/g, ''),
                pic = jsp.pdfh(item, ".image&&img:eq(0)&&src");
            videos.push({
                'url': 'https://api.cntv.cn/search---'+title+'---'+url+'---'+pic,
                'title': title,
                'img': pic,
                'desc': ''
            })
        });
        results = jsp.pdfa(content, '.search17354_ind02 ul&&li');
        results.forEach(function(item) {
            let url = jsp.pdfh(item, "a:eq(0)&&href"),
                title = jsp.pdfh(item, "a:eq(0)&&title"),
                pic = jsp.pdfh(item, "a&&img:eq(0)&&src");
            videos.push({
                'url': 'https://api.cntv.cn/search---'+title+'---'+url+'---'+pic,
                'title': title,
                'img': pic,
                'desc': ''
            })
        });
        setResult(videos)
    `,
}